package com.ruoyi.appointment.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.appointment.mapper.AppointmentMapper;
import com.ruoyi.appointment.domain.Appointment;
import com.ruoyi.appointment.service.IAppointmentService;

/**
 * 技师可预约时段Service业务层处理
 *
 * @author ch
 * @date 2022-07-26
 */
@Service
public class AppointmentServiceImpl implements IAppointmentService
{
    @Autowired
    private AppointmentMapper appointmentMapper;

    /**
     * 查询技师可预约时段
     *
     * @param id 技师可预约时段主键
     * @return 技师可预约时段
     */
    @Override
    public Appointment selectAppointmentById(Long id)
    {
        return appointmentMapper.selectAppointmentById(id);
    }

    /**
     * 查询技师可预约时段列表
     *
     * @param appointment 技师可预约时段
     * @return 技师可预约时段
     */
    @Override
    public List<Appointment> selectAppointmentList(Appointment appointment)
    {
        return appointmentMapper.selectAppointmentList(appointment);
    }

    /**
     * 新增技师可预约时段
     *
     * @param appointment 技师可预约时段
     * @return 结果
     */
    @Override
    public int insertAppointment(Appointment appointment)
    {
        appointment.setCreateTime(DateUtils.getNowDate());
        return appointmentMapper.insertAppointment(appointment);
    }

    /**
     * 修改技师可预约时段
     *
     * @param appointment 技师可预约时段
     * @return 结果
     */
    @Override
    public int updateAppointment(Appointment appointment)
    {
        appointment.setUpdateTime(DateUtils.getNowDate());
        return appointmentMapper.updateAppointment(appointment);
    }

    /**
     * 批量删除技师可预约时段
     *
     * @param ids 需要删除的技师可预约时段主键
     * @return 结果
     */
    @Override
    public int deleteAppointmentByIds(Long[] ids)
    {
        return appointmentMapper.deleteAppointmentByIds(ids);
    }


    /**
     * 批量逻辑删除技师可预约时段
     *
     * @param ids 需要删除的技师可预约时段主键
     * @return 结果
     */
    @Override
    public int logicDeleteAppointment(Long[] ids,String delType,Long delUser)
    {
        return appointmentMapper.logicDeleteAppointment(ids,delType,delUser);
    }

    /**
     * 删除技师可预约时段信息
     *
     * @param id 技师可预约时段主键
     * @return 结果
     */
    @Override
    public int deleteAppointmentById(Long id)
    {
        return appointmentMapper.deleteAppointmentById(id);
    }
    /**
     * 批量插入
     * @param batchList
     * @return
     */
    public int batchAppointment(List<Appointment>batchList){
        return appointmentMapper.batchAppointment(batchList);
    }
}
